<template>
	<div
		v-if="loaded"
		id="app"
	>
		<router-view	/>
	</div>
</template>

<script>
import { tokenLogin } from '@/api/user'

export default {
  name: 'app',
  provide() { // 注入reload方法
    return {
      reload: this.reload
    }
  },
  data() {
    return {
      loaded: false,
      showView: true
    }
  },
  created() {
    this.loaded = true
    tokenLogin()
  },
  methods: {
    /**
     * 重新渲染
     */
    reload() {
      this.showView = false
      this.$nextTick(() => {
        this.showView = true
      })
    },
  }
}
</script>

<style lang="scss">
body {
  margin: auto;
}
</style>
